using System.Windows.Forms;
using System.Drawing;
using Drawing3d;
namespace Sample
{
public partial class Form1 : Form
{
MyDevice Device = new MyDevice();
public Form1()
{
InitializeComponent();
Device.WinControl = this;
}
}
public class MyDevice:OpenGlDevice
{
Texture T = new Texture();
Curve2d CustomCurve = new Curve2d();
CoordinateAxis Axis = new CoordinateAxis();
public override void OnPaint()
{
base.OnPaint();
PolygonMode = PolygonMode.Line;
Axis.Paint(this);
PenWidth = 2;
drawCurve(CustomCurve);
PenWidth = 1;
}
protected override void OnCreated()
{
base.OnCreated();
BackColor = Color.White;
CustomCurve.Resolution = 60;
CustomCurve.OnGetValue += CustomCurve_OnGetValue;
Axis.Dim3d = false;
Axis.TextHeight = 0.5;
}
private xy CustomCurve_OnGetValue(object sender, double t)
{
t = (t - 0.5) * 2.5; // Map from [0,1].
return new xy(4 * (t * t - 1), 4 * t * (t * t - 1));
}
}
}